/**
 * 
 */
package com.coders.vimek.Javatutorials;

/**
 * @author vimek
 *
 */
public class JavaOperatorExamples {

	/**
	 * @param args
	 */
	int i,j,k,s,m,p,r;
	double d;
	boolean t ;
	boolean f ;
	JavaOperatorExamples()
	{
		//Usage Assignment operators
		System.out.println("Variables are initialized in the CONSTRUCTOR");
		i=10;
		j=20;
		k=30;
		s=0;
		m=0;
		d=0.0;
		p=0;
		r=0;
		 t = true;
		f = false;
		
	}
	
	public void display()
	{
		//Print the value of i,j,k using the display() function
		System.out.println("The value of i,j,k using the display() function are ");
		System.out.println("i is "+i);
		System.out.println("j is "+j);
		System.out.println("k is "+k);
		System.out.println();
		
	}
	
	public void wrapper()
	{
		//Usage of Arithematic operations
		System.out.println("Arithematic operations");
		Integer i1 = new Integer("32");
		Integer i2 = new Integer("10");
		
		System.out.println("i1 is : " + i1);
		System.out.println("i2 is : " + i2);
		s=i1+i2;
		m=i1-i2;
		d=i1/i2;
		p=i1*i2;
		r=i1%i2;
		System.out.println("Sum is : " + s);
		System.out.println("Difference is : " + m);
		System.out.println("Dividend is : " +d);
		System.out.println("Product is : " + p);
		System.out.println("Remainder is : " + r);
		System.out.println("Increment of i1 is : " + (++i1));
		System.out.println("Decrement of i2 is : " + (--i2));
		
	
			
	}
	
	public void  Relationaloperators() {

		//Usage of relational operators

		 System.out.println("RELATIONAL OPERATIONS(which returns boolean)");
			
	     System.out.println("i > j : "+(i> j));
	     System.out.println("i < j : "+(i< j));
	     System.out.println("i >= j : "+(i>=j));
	     System.out.println("i <= j : "+(i<=j));
	     System.out.println("i == j : "+(i== j));
	     System.out.println("i != j : "+(i!= j));
	     	
		
	}
	
	public void	LogicalOperators()
	{

		//Usage of Logical operators

		 System.out.println("LOGICAL OPERATIONS(which returns boolean)");
		 
		 System.out.println("t & f : " + (t & f));
		 System.out.println("t && f : " + (t && f));
		 System.out.println("t | f : " + (t | f));
		 System.out.println("t || f : " + (t || f));
		 System.out.println("x ^ y : " + (t ^ f));
		 System.out.println("!t : " + (!t));
	}
	
	public void TernaryOperators()
	{
		System.out.println("TERNARY OPERATOR EXAMPLE" );
		int x = 10, y = 12, z = 0;
		z = x > y ? x : y;
		System.out.println("z : " + z);
		
	}
	
public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		
		JavaOperatorExamples obj= new JavaOperatorExamples();
			obj.display();
			obj.wrapper();
			obj.Relationaloperators();
			obj.LogicalOperators();
			obj.TernaryOperators();
	}

}
